package com.example.jt_web.controller;

import com.example.jt_common.vo.ItemCatResult;
import com.example.jt_manager_service.ItemCatServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;


@Controller
public class IndexController {

    @Autowired
    ItemCatServiceImpl itemCatService;

    @RequestMapping("index")
    public String showIndex(){
        return "index";
    }

    @RequestMapping("/web/itemcat/all")
    @ResponseBody
    public ItemCatResult getCatsTree(){
        ItemCatResult itemCatResult = itemCatService.getAllCats();
        return itemCatResult;
    }
}
